<%--
  Created by IntelliJ IDEA.
  User: lanou
  Date: 18/1/27
  Time: 上午9:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="p" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">

    <title>购买记录</title>

    <!-- Bootstrap core CSS -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="http://cdn.staticfile.org/twitter-bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" type="text/css" media="all"/>
    <link href="http://cdn.staticfile.org/highlight.js/7.3/styles/github.min.css" rel="stylesheet" type="text/css" media="all"/>




    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>

</head>
<!-- NAVBAR
================================================== -->
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/index">幻想天堂</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">

            <div class="navbar-right" >
                <a  class="navbar-brand" href="#" id="name">${sessionScope.get('name')}</a>
                <a  class="navbar-brand" href="#">账户余额：${sessionScope.get('money')}</a>
                <button type="button" class="btn btn-primary"
                        data-toggle="modal" data-target="#myModal">账户充值</button>
                <%--<button type="submit" class="btn btn-primary"><a href="/exit">退出</a></button>--%>
                <input class='btn btn-success' type='button' id='exit' value='退出'>
            </div>


        </div><!--/.navbar-collapse -->
    </div>
</nav>
<!-- Carousel
================================================== -->
<div class="container">

    <div class="row row-offcanvas row-offcanvas-right">

        <div class="col-xs-12 col-sm-9">
            <p class="pull-right visible-xs">
                <button type="button" class="btn btn-primary btn-xs" data-toggle="offcanvas">Toggle nav</button>
            </p>
            <div class="jumbotron">
                <h1>Hello, 穷逼!</h1>
                <p>这些都是你想买的东西，你真有这么多钱吗？做做梦就行了</p>
            </div>
            <div class="row">
                <p:forEach var="d" items="${shops.list}">
                    <div class="col-xs-6 col-lg-4">
                        <img style="width: 200px;height: 150px" src="${d.url}">
                        <h2>${d.dname}</h2>
                        <p>${d.dabout}</p>
                        ￥${d.maney}<br>
                            <%--<input type="hidden" value="${d.id}" class="id">--%>

                        <%--<p><input type="button" did="${d.id}" class="btn btn-default" buy="buy" value="购买&raquo;"></p>--%>
                    </div><!--/.col-xs-6.col-lg-4-->
                </p:forEach>

            </div><!--/row-->

        </div><!--/.col-xs-12.col-sm-9-->
        <form id="pageForm" action="/success/buycar" method="post">
            <input id="pageNum" type="hidden" value="1" name="pageNum">
        </form>
    </div>

    <div id="page" class="pagination"></div>
    <!-- FOOTER -->
    <footer>
        <p class="pull-right"><a href="#">Back to top</a></p>
        <p>&copy; 2018 Company, Inc.</p>
    </footer>

</div><!-- /.container -->


<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="http://cdn.staticfile.org/jquery/1.10.1/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/jqpaginator.min.js"></script>
<script type="text/javascript" src="http://cdn.staticfile.org/twitter-bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script type="text/javascript" src="http://cdn.staticfile.org/highlight.js/7.3/highlight.min.js"></script>

<script>
    $('#page').jqPaginator({
        // 总页数
        totalPages:${shops.pages},
        // 显示的页签个数
        visiblePages:5,
        // 总条数
        totalCounts:${shops.total},
        // 当前页数
        currentPage:${shops.pageNum},
        onPageChange: function (num, type) {
            if(num != ${shops.pageNum}) {
                $("#pageNum").val(num);
                $("#pageForm").submit();
            }
        }
    });

    $(document).ready(function () {
        $("#exit").on("click",function () {
            $.ajax({
                type:'post',
                url:'/exit',
                success:function () {
                    window.location.reload();
                },
                error:function () {
                    alert("shibai");
                }
            })
        })

    })


</script>

</body>
</html>